<#include "/client/config.ftl"/>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="${base}/css/bootstrap.min.css" />
		<script type="text/javascript" src="${base}/js/jquery-1.12.0.min.js"></script>
		<link rel="stylesheet" href="${base}/css/common.css" />
	</head>

	<body>
		<div class="container-fluid">
			<fieldset disabled>
			<ul>
				<li class="list_each no_border">
					<div class="item">
						<span class="key">姓名：</span>
						<span class="value">${task.sikerName}</span>
					</div>
				</li>
				<li class="list_each no_border">
					<div class="item">
						<span class="key">所属组：</span>
						<span class="value">${task.groupName}</span>
					</div>
				</li>
				<li class="list_each no_border">
					<div class="item">
						<span class="key">任务内容：</span>
						<#if task.tsType == 1>
							<span class="value">疼痛评估任务</span>
						<#elseif task.tsType == 2>
							<span class="value">不良反应反馈任务</span>
						<#elseif task.tsType == 3>
							<span class="value">依从性评价任务</span>
						<#elseif task.tsType == 4>
							<span class="value">健康评估任务</span>
						<#elseif task.tsType == 5>
							<span class="value">滴定任务</span>
						<#else>
							<span class="value">服药提醒任务</span>
						</#if>
					</div>
				</li>
				<li class="list_each no_border">
					<div class="item">
						<span class="key">药品名称：</span>
						<span class="value">${task.task.medicName}</span>
					</div>
				</li>
				<li class="list_each no_border">
					<div class="item">
						<span class="key">执行日期：</span>
						<span class="value">${task.strDate}</span>
					</div>
				</li>
				<li class="list_each no_border">
					<div class="item">
						<span class="key">任务状态：</span>
						<#if task.status == 1>
							<span id="alert_status" class="value">未完成</span>
						<#else>
							<span id="alert_status" class="value">已完成</span>
						</#if>
					</div>
				</li>
			</ul>
			</fieldset>
			<#if task.status == 2>
				<div class="form-group login_reg_btn mar_top mar_bottom">
					<button class="btn btn-primary" disabled>已服用</button>
				</div>
			<#else>
				<div class="form-group login_reg_btn mar_top mar_bottom">
					<button id="finish" class="btn btn-primary">确认服用</button>
					<div class="hidden_area">
						<input type="hidden" value="${task.tsId}" id="tsId">
					</dvi>
				</div>
			</#if>
			<!--
			<#if user?exists>
			<#else>
				<#if (doctor?exists && (task.status == 7 || task.status == 10 || task.status == 11)) || (assitant?exists && (task.status == 6 || task.status == 9 || task.status == 11)) || (pharmacist?exists && (task.status == 5 || task.status == 9 || task.status == 10)) || (task.status == 14 && (doctor?exists || assitant?exists || pharmacist?exists))>
					<div class="form-group login_reg_btn mar_top mar_bottom">
						<button class="btn btn-primary" disabled>已批阅</button>
					</div>
				<#else>
					<div class="form-group login_reg_btn mar_top mar_bottom">
						<button id="checkup" class="btn btn-primary">批阅</button>
						<div class="hidden_area">
							<input type="hidden" value="${task.tsId}" id="tsId">
						</dvi>
					</div>
				</#if>
			</#if>
			-->
		</div>
		<script>
			$(document).ready(function(){
				$("#finish").click(function(){
					var tsId = $("#tsId").val();
					$.ajax({
						type:"get",
						url:"${base}/client/task/sureAlert",
						dataType:"json",
						data:{
							"tsId":tsId
						},
						success:function(data){
							if(data.result == "success"){
								alert("确认成功");
								$("#finish").text("已服用");
								$("#finish").attr("disabled","disabled");
								$("#alert_status").text("已完成");
							}else{
								alert("确认失败");
							}
						}
					});
				});
			});
			<!--
			$(document).ready(function(){
				<#if user?exists>
				<#else>
					$("#checkup").click(function(){
						var tsId = $("#tsId").val();
						$.ajax({
							type:"get",
							<#if doctor?exists>
								url:"${base}/client/task/checkupByDoctor",
							<#elseif assitant?exists>
								url:"${base}/client/task/checkupByAssi",
							<#else>
								url:"${base}/client/task/checkupByPhar",
							</#if>
							dataType:"json",
							data:{
								"tsId":tsId
							},
							success:function(data){
								if(data.result == "success"){
									alert("批阅完成");
									$("#checkup").text("已批阅");
									$("#checkup").attr("disabled","disabled");
								}else{
									alert("批阅失败");
								}
							}
						});
					});
				</#if>
			});
			-->
		</script>
	</body>

</html>